document.addEventListener('DOMContentLoaded', () => {
    const particleCount = 100;
    const particlesContainer = document.getElementById('particles-container');

    function generateParticles() {
        for (let i = 0; i < particleCount; i++) {
            const particle = document.createElement('div');
            particle.classList.add('particle');

            const x = Math.random() * 100; // 随机X轴位置
            const delay = Math.random() * 5; // 随机延迟
            const size = Math.random() * 5 + 1; // 随机大小，1px到5px
            const opacity = Math.random() * 0.5 + 0.3; // 随机透明度，介于0.3到0.8之间

            particle.style.left = x + 'vw';
            particle.style.animationDelay = delay + 's';
            particle.style.width = size + 'px';
            particle.style.height = size + 'px';
            particle.style.opacity = opacity;

            particlesContainer.appendChild(particle);
        }
    }

    generateParticles(); // 页面加载时生成粒子
});
